package com.onetwork.core.ui.components;

import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;

public class ONetworkTreeCellRenderer extends DefaultTreeCellRenderer {
    private static final long serialVersionUID = 1L;
    private ImageIcon geralIcon;
    public ONetworkTreeCellRenderer() {
        geralIcon = new ImageIcon(ONetworkTreeCellRenderer.class.getResource("/imagens/index.png"));
    }
    
    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
        if (leaf) {
            setIcon(geralIcon);
            setToolTipText("Dados gerais do cadastro");
        } else {
            setToolTipText(null);
        }
        return this;
    }
}
